const url = require('url');
// 解析
var urlObj = url.parse('http://8.129.235.230/JS%E5%AD%A6%E4%B9%A0/test2.php?username=luo&password=123456');
console.log(urlObj);
// 格式化
var url1 = url.format({
    protocol: "http:",
    host: "182.163.0:60",
    port: "60"
})
console.log(url1);
// 拼接
var res = url.resolve("http://lezijie.com", "improve");
console.log(res);